package com.borko.healthcare.persistence.hibernate.dao;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.borko.healthcare.entities.beans.OrderBean;
import com.borko.healthcare.entities.interfaces.Order;

public class OrderDAOImpl extends HibernateDaoSupport implements OrderDAO {
	
	private void createOrUpdate(Order order) {
		getHibernateTemplate().saveOrUpdate(order);
	}

	public void create(Order order) {
		createOrUpdate(order);
	}

	public void delete(Order order) {
		getHibernateTemplate().delete(order);
	}

	public List<Order> retrive() {
		return getHibernateTemplate().loadAll(Order.class);
	}

	public void update(Order order) {
		getHibernateTemplate().saveOrUpdate(order);
	}
	
	public Order getOrder(int id) {
		return getHibernateTemplate().get(OrderBean.class, id);
	}

}
